# -*- cmake -*-

message("Entering ${CMAKE_CURRENT_SOURCE_DIR}/")

set(NLS_IRR_MODULE "IrrlichtRender")
message("Adding ${NLS_IRR_MODULE}...")

# get all the cxx files that need to be compiled
set(SOURCE_FILES
	# Specify all the cxx files that need to be compiled (in alphabetic order)
	"src/DLLMain.cpp"
	"src/IrrlichtRender.cpp"
)

set(HEADER_FILES
	"src/IrrlichtRender.h"
)
# Put the files into groups in the editor.
source_group("Source" FILES ${SOURCE_FILES})
source_group("Headers" FILES ${HEADER_FILES})

include_directories("${CMAKE_CURRENT_SOURCE_DIR}/include/")

add_library(${NLS_IRR_MODULE} SHARED ${SOURCE_FILES} ${HEADER_FILES}) 

# Specify dependencies
add_dependencies(${NLS_IRR_MODULE} "angelscript")
add_dependencies(${NLS_IRR_MODULE} "sharedbase")
add_dependencies(${NLS_IRR_MODULE} "irrlicht")

set(NLS_IRR_MODULE_LIBS
	"${LIBRARY_OUTPUT_PATH}/sharedbase.lib"
	"OpenGL32.lib"
	"GLu32.lib"
	"${CMAKE_CURRENT_SOURCE_DIR}/lib/Irrlicht.lib"
		debug "${LIBRARY_OUTPUT_PATH}/libboost_chrono-vc100-mt-gd-1_47.lib"
		debug "${LIBRARY_OUTPUT_PATH}/libboost_date_time-vc100-mt-gd-1_47.lib"
		debug "${LIBRARY_OUTPUT_PATH}/libboost_filesystem-vc100-mt-gd-1_47.lib"
		debug "${LIBRARY_OUTPUT_PATH}/libboost_system-vc100-mt-gd-1_47.lib"
		debug "${LIBRARY_OUTPUT_PATH}/libboost_thread-vc100-mt-gd-1_47.lib"
		
		optimized "${LIBRARY_OUTPUT_PATH}/libboost_chrono-vc100-mt-1_47.lib"
		optimized "${LIBRARY_OUTPUT_PATH}/libboost_date_time-vc100-mt-1_47.lib"
		optimized "${LIBRARY_OUTPUT_PATH}/libboost_filesystem-vc100-mt-1_47.lib"
		optimized "${LIBRARY_OUTPUT_PATH}/libboost_system-vc100-mt-1_47.lib"
		optimized "${LIBRARY_OUTPUT_PATH}/libboost_thread-vc100-mt-1_47.lib"
)

message("Adding to ${NLS_IRR_MODULE} the libraries: ${NLS_IRR_MODULE_LIBS}")
target_link_libraries(${NLS_IRR_MODULE} ${NLS_IRR_MODULE_LIBS})

file(MAKE_DIRECTORY "lib/")
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/GetIrrlicht.cmake")

message("Exiting ${CMAKE_CURRENT_SOURCE_DIR}/")
